#include <iostream>
#include <cstdio>
#include "ProtoDefine.h"
#include "MessageFactoryImp.h"

int main()
{
	MessageFactoryImp::instance()->init();
	Proto50600101 respond;
	respond.set_role_id(-5238855566547LL);
	for (int i = 0; i < 3; ++i)
	{
		ProtoSceneAddress *address = respond.add_scene_addrs();
		address->set_scene_id(10100 + i);
		address->set_address("127.0.0.1");
		address->set_port(0);
		address->set_domain("www.baidu.com");
	}
	respond.set_ban_type(1);
	respond.set_left_ban_sec(-5600);
	std::cout << respond.DebugString() << std::endl;
	std::string buffer;
	if (respond.SerializeToString(&buffer) == false)
		std::cout << "serial error" << std::endl;
	std::cout << "buffer size: " << buffer.size() << std::endl;
	for (int i = 0; i < buffer.size(); ++i)
	{
		::printf("%02x ", (unsigned char)buffer[i]);
	}
	std::cout << std::endl;
	Proto50600101 unserial_msg;
	unserial_msg.ParseFromString(buffer);
	std::cout << unserial_msg.DebugString() << std::endl;
	return 0;
}
